#ifndef DIO_DISK_QUEUES_H_
#define DIO_DISK_QUEUES_H_

#include <fermat/common/singleton.h>
#include <fermat/common/mutex.h>
#include <fermat/dio/file_base.h>
#include <fermat/dio/request.h>
#include <fermat/dio/request_queue.h>
#include <map>

namespace fermat {

class DiskQueues : public Singleton<DiskQueues> {

protected:
    DiskQueues();

public:
    typedef  int64_t DiskId ;

    ~DiskQueues();

	void stop();

    void MakeQueue(const FileBasePtr& file);

    void AddRequest(RequestPtr& req, DiskId disk);

    bool CancelRequest(RequestPtr &req, DiskId disk);

    RequestQueue * GetQueue(DiskId disk);

    void SetPriorityOp(RequestQueue::PriorityOp op);
private:
	typedef std::map<DiskQueues::DiskId, RequestQueue*> RequestQueueMap ;
	
    friend class Singleton<DiskQueues>;
    RequestQueueMap _queues;

};

}

#endif 
